﻿namespace IBTrader.Charts.Drawing
{
    using System.Drawing;

    class ChartPoint : BaseChart
    {
        private readonly float size;
        private readonly bool fill;
        public ChartPoint(Worker worker, Color color, bool fill = true, float size = 5f) : base(worker)
        {
            this.Color = color;
            this.fill = fill;
            this.size = size;
        }
        public override void Draw(IGraphics g, Charts.Region region)
        {
            foreach (var line in Lines)
            {
                var rectangle = new RectangleF(region.x(line) - size / 2, region.y(line) - size / 2, size, size);
                if (fill)
                    g.FillPie(new SolidBrush(Color), Rectangle.Round(rectangle), 1, 360);
                else
                    g.DrawPie(Pen(), rectangle, 1, 360);
            }
        }
    }
}